package com.atguigu.lease.common.context;

//操作threadlocal本地线程的工具类
public class LoginUserContext {
    private static ThreadLocal<LoginUser> threadLocal = new ThreadLocal<>();

    //把token解析出来的用户信息保存到本地线程中

    public static void setLoginUser(LoginUser loginUser){
        threadLocal.set(loginUser);
    }
    //把token解析出来的用户信息从本地线程查询出来

    public static LoginUser getLoginUser(){
       return threadLocal.get();
    }
    //把token解析出来的用户信息从本地线程删除
    public static void removeLoginUser(){
        threadLocal.remove();
    }
}
